<%-- 
    Document   : viewEnrich
    Created on : 23-feb-2014, 16:58:46
    Author     : Juan
--%>

<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%
    /*Se obtienen las lista de session para a continuación pintarkas*/
    List<String> listaNombres = (List<String>) session.getAttribute("nombres");
    List<Double> listaPvalues = (List<Double>) session.getAttribute("pvalues");
    List<Double> listaBonferronis = (List<Double>) session.getAttribute("bonferronis");
    List<Double> listaBonferronisStepDown = (List<Double>) session.getAttribute("bonferronisStepDown");
    String db = (String)session.getAttribute("db");
    String cabecera="";
    if(db.equals("kegg")){
        cabecera= "Pathway";
    }
    else{
        cabecera = "GO-Term";
    }
        

    /*Se pinta la tabla que será recogida mediante Out*/
    String ficPhp = "<table>"
            + "<thead>"
            + "<tr>"
            + "<th>"+cabecera+"</th>"
            + "<th>Pvalue</th>"
            + "<th>Bonferroni Correction</th>"
            + "<th>Bonferroni Step Down Correction</th>"
            + "</tr>"
            + "</thead>";

    ficPhp += "<tbody>";
    for (int i = 0; i < listaNombres.size(); i++) {

        Double pva = listaPvalues.get(i);
        String respva = "";
        if (pva < 0.001) {
            respva = "<0.001";
        } else {
            respva = "" + pva;
        }
        
        Double bf = listaBonferronis.get(i);
        
        String resbf = "";
        if (bf < 0.001) {
            resbf = "<0.001";
        } else {
            resbf = "" + bf;
        }
        
        Double bfsd = listaBonferronisStepDown.get(i);
        String resbfsd = "";
        if (bfsd < 0.001) {
            resbfsd = "<0.001";
        } else {
            resbfsd = "" + bfsd;
        }
        ficPhp += "<tr>";
        ficPhp += "<td>" + listaNombres.get(i) + "</td>";
        ficPhp += "<td>" + respva + "</td>";
        ficPhp += "<td>" + resbf + "</td>";
        ficPhp += "<td>" + resbfsd + "</td>";
        ficPhp += "</tr>";

    }
    ficPhp += "</tbody>";

    ficPhp += "</table>";

    out.append(ficPhp);

%>